package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
	"time"
)

type HzSystemUrl struct {
	ent.Schema
}

// Fields of the MallSystemConfig.
func (HzSystemUrl) Fields() []ent.Field {
	return []ent.Field{
		field.String("system_key").NotEmpty().Comment("配置key"),
		field.String("sub_key").Optional().Comment("配置子key"),
		field.Text("value").NotEmpty().Comment("配置值"),
		field.String("description").Optional().Comment("配置描述"),
		field.Int64("created_at").Immutable().Default(time.Now().Unix()).Comment("创建时间"),
		field.Int64("update_at").Default(time.Now().Unix()).Comment("更新时间"),
		field.Int64("delete_at").Optional().Comment("删除时间"),
	}
}

func (HzSystemUrl) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("system_key"),
	}
}

func (HzSystemUrl) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("系统地址表"),
	}
}
